g_timeout_add (100, (GSourceFunc)pulse_it, widget);
widget = (GtkWidget *)gtk_builder_get_object (builder, "scale3");
- gtk_scale_set_format_value_func (GTK_SCALE (widget), scale_format_value, NULL);
+ gtk_scale_set_format_value_func (GTK_SCALE (widget), scale_format_value, NULL, NULL);
widget = (GtkWidget *)gtk_builder_get_object (builder, "scale4");
- gtk_scale_set_format_value_func (GTK_SCALE (widget), scale_format_value_blank, NULL);
+ gtk_scale_set_format_value_func (GTK_SCALE (widget), scale_format_value_blank, NULL, NULL);
widget = (GtkWidget *)gtk_builder_get_object (builder, "box_for_context");
model = (GMenuModel *)gtk_builder_get_object (builder, "new_style_context_menu_model");
GtkScaleFormatValueFunc format_value_func;
gpointer format_value_func_user_data;
+ GDestroyNotify format_value_func_destroy_notify;
guint draw_value : 1;
guint value_pos : 2;
g_clear_pointer (&priv->value_widget, gtk_widget_unparent);
+ if (priv->format_value_func_destroy_notify)
+ priv->format_value_func_destroy_notify (priv->format_value_func_user_data);
+
G_OBJECT_CLASS (gtk_scale_parent_class)->finalize (object);
}
* @scale: a #GtkScale
* @func: (nullable): function that formats the value
* @user_data: (nullable): user data to pass to @func
+ * @destroy_notify: (nullable): destroy function for @user_data
*
* @func allows you to change how the scale value is displayed. The given
* function will return an allocated string representing @value.
void
gtk_scale_set_format_value_func (GtkScale *scale,
GtkScaleFormatValueFunc func,
- gpointer user_data)
+ gpointer user_data,
+ GDestroyNotify destroy_notify)
{
GtkScalePrivate *priv = gtk_scale_get_instance_private (scale);
GtkAdjustment *adjustment;
g_return_if_fail (GTK_IS_SCALE (scale));
+ if (priv->format_value_func_destroy_notify)
+ priv->format_value_func_destroy_notify (priv->format_value_func_user_data);
+
priv->format_value_func = func;
priv->format_value_func_user_data = user_data;
+ priv->format_value_func_destroy_notify = destroy_notify;
if (!priv->value_widget)
return;